//获得slider插件对象
var gallery = mui('.mui-slider');
gallery.slider({
	interval: 5000 //自动轮播周期，若为0则不自动播放，默认为0；
});

function requestData(requestUrl, requestType, successFun, errorFun) {
	mui.ajax(requestUrl, {
		data: {
			username: 'username',
			password: 'password'
		},
		crossDomain: true,
		dataType: 'json', //服务器返回json格式数据
		type: requestType, //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			//服务器返回响应，根据响应结果，分析是否登录成功；
			successFun(data)
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			console.log(type);
		}
	});
}

mui("#jindutiao .mui-progressbar").each(function() {
	mui(this).progressbar({
		progress: this.getAttribute("data-progress")
	}).show();
});

//涉及到HTML5+的api都写在该方法里面
mui.plusReady(function() {
	console.log('aaa')
	requestData('http://127.0.0.1:8360/api/index/index', 'get', function(data) {
		console.log('data', data)
	})

});

mui.init({
	preloadPages: [{
		url: 'other/personalInfo.html',
		id: 'personalInfo',
//		styles: {
//			top: configs.headerH,
//			bottom: configs.navH
//		}
	}, {
		url: 'other/map.html',
		id: 'map',
	}],
	swipeBack: false,
});

//进入到地图页
function goPage(toUrl) {
//		plus.webview.open(toUrl, null, null, "slide-in-right")
//	mui.openWindow({
//		url: 'other/personalInfo.html',
//		id: 'personalInfo',
//		show: {
//			aniShow: 'fade-in'
//		},
////		styles: {
////			top: 0,
////			bottom: configs.navH
////		}
//	});
	var w = plus.webview.create('other/map.html');
	plus.webview.show(w,'fade-in',300);
	
}

//进入到个人信息页面
function goPersonalInfo() {
	var w = plus.webview.create('other/personalInfo.html');
	plus.webview.show(w,'fade-in',300);
}

//进入城市页面
function goCityPage() {
	var w = plus.webview.open('other/city.html', null, null, "slide-in-right")
}

function TEST() {
	plus.webview.open('other/city.html', null, null, "slide-in-right")
}